unit UFrmRegistro;

interface

uses
  Windows, Registry, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  lmdcompo, lmdclass, lmdformA, dxCore, dxButton, StdCtrls, lmdctrl,
  lmdextcA, lmdstdcS, lmdextcS, jpeg, ExtCtrls;

type
  TFrmRegistro = class(TForm)
    Label2: TLMDLabelFill;
    LMDTechnicalLine1: TLMDTechnicalLine;
    LMDLabelFill3: TLMDLabelFill;
    dxButton1: TdxButton;
    dxButton2: TdxButton;
    LMDFormFill1: TLMDFormFill;
    Edit1: TEdit;
    Image1: TImage;
    Bevel1: TBevel;
    procedure dxButton2Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure dxButton1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FrmRegistro: TFrmRegistro;

implementation

{$R *.DFM}

procedure TFrmRegistro.dxButton2Click(Sender: TObject);
begin
   application.terminate;
end;

procedure TFrmRegistro.FormShow(Sender: TObject);
var
   x, y : integer;
begin
   x := handle;
//   label2.caption := inttostr(x);
   y := strtoint(formatdatetime('dd',time));
   x := (((x * 2)+1234)-2111)+(y);
   label2.caption := inttostr(x);
end;

procedure TFrmRegistro.dxButton1Click(Sender: TObject);
var
   x , y : integer;
   Registro : TRegistry;
begin
   y := strtoint(formatdatetime('dd',time));
   x := strtoint(edit1.text);
   x := (((x * 2)+1234)-2111)+(y);
   if x = strtoint(label2.caption) then
   begin
      Registro := TRegistry.Create;
   try
      Registro.RootKey := HKEY_LOCAL_MACHINE;
      Registro.OpenKey('\Software\Kallel\Microsoft',true);
      Registro.WriteString('EDOS','correto');
   finally
      Registro.Free;
      close;
   end;
   end
   else
      Showmessage('Você não digitou a senha correta! Tente novamente!');
end;

end.
